<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Sockets test: open without user gesture fails</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
  </head>
  <body>
    <script>
      'use strict';

      promise_test(t => {
        return promise_rejects_dom(
            t, 'NotAllowedError',
            navigator.openTCPSocket({remotePort: 53}));
      }, 'openTCPSocket without a user gesture');

      promise_test(t => {
        return promise_rejects_dom(
            t, 'NotAllowedError',
            navigator.openUDPSocket({remotePort: 53}));
      }, 'openUDPSocket without a user gesture');
    </script>
  </body>
</html>
